package com.ruoyi.system.domain.vo;

import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.bean.BeanUtils;
import com.ruoyi.system.domain.ProcessCheckHistoryinfo;
import lombok.Data;

import java.util.Arrays;
import java.util.List;


/**
 * 流程审核-历史记录视图对象 process_check_historyinfo
 *
 * @author ruoyi
 * @date 2024-04-10
 */
@Data
public class ProcessCheckHistoryinfoVo {

    private static final long serialVersionUID = 1L;

    /**
     *
     */
    private Long id;

    /**
     * 审核id
     */
    private Long checkId;

    /**
     * 状态0:待审核1：通过2：驳回
     */
    private String state;

    /**
     * 流程所处阶段0：发起 1：1审核 2：2审
     */
    private String processStage;

    /**
     * 审核人id
     */
    private Long subjectOfficer;

    /**
     * 是否为终节点1：是 0：否
     */
    private String isFinal;

    /**
     * 审核意见
     */
    private String checkOpinion;

    /**
     * 抄送人id列表
     */
    private List<Integer> copyFor;

    /**
     * 继续审核的id
     */
    private List<Integer> keepCheckId;


    public static ProcessCheckHistoryinfoVo build(ProcessCheckHistoryinfo info) {
        ProcessCheckHistoryinfoVo vo = new ProcessCheckHistoryinfoVo();
        BeanUtils.copyProperties(info, vo, "copyFor","keepCheckId");
        vo.setCopyFor(StringUtils.isEmpty(info.getCopyFor()) ? null : StringUtils.convertStringListToIntegerList(Arrays.asList(info.getCopyFor().split(","))));
        vo.setKeepCheckId(StringUtils.isEmpty(info.getKeepCheckId()) ? null : StringUtils.convertStringListToIntegerList(Arrays.asList(info.getKeepCheckId().split(","))));

        return vo;

    }
}
